package cn.it.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/login")
    public Object login(String code,String avatarUrl,String nickName ){

        String url = "https://api.weixin.qq.com/sns/jscode2session?appid=wx3a6347bb53bbff84&secret=fddfedb773e30678c9b03fb8898cae07" +
                "&js_code=" + code + "&grant_type=authorization_code";

        RestTemplate restTemplate = new RestTemplate();
        System.out.println(url);
        ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
        System.out.println(forEntity.getHeaders());
        System.out.println(forEntity.getBody());
        return null;
    }

    public static void main(String[] args) {

    }
}
